package com.ysd.crm.controller;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.ysd.crm.entity.Dynamicmessages;
import com.ysd.crm.service.DynamicmessagesService;
import com.ysd.crm.utils.LayResult;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@RequestMapping("/dynami")
@Api
@RestController
public class DynamicmessagesController {

	@Autowired
	private DynamicmessagesService dService;
	
	
	@ApiOperation("添加学生信息 Dynamicmessages ydd")
	@PostMapping("insertDynamicmessages")
	public Object insertDynamicmessages(Dynamicmessages d) {
		SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		d.setCreateTime(df.format(new Date()));
		int n = dService.addDynamicmessages(d);
		if (n>0) {
			return LayResult.toClient("0", "添加成功");
		} else {
			return LayResult.toClient("1", "添加失败");

		}
	}
}
